import { Injectable } from '@angular/core';
import {Observable} from "rxjs/Observable";
import {MsgResult} from "../../../../models/msg-result";
import {DamAPI} from "../../peach-constants";
import {RequestUtil} from "../../../../util/request-util";

@Injectable()
export class AirqualityCompareService {

  constructor(
    private requestUtil: RequestUtil
  ) { }

  //不同用户不同站点
  getUserSiteData():Observable<MsgResult>{
    return this.requestUtil.get(DamAPI.getUserSite);
  }


  getNationSiteData():Observable<MsgResult>{
    let params = "format=json&pointType=allNationalSite";
    return this.requestUtil.get(DamAPI.getNationSiteData,params);
  }
  getSmallSiteData():Observable<MsgResult>{
    let params = "format=json&pointType=smallAirSite";
    return this.requestUtil.get(DamAPI.getSmallSiteData,params);
  }
  getAirQualityCompareData(obj):Observable<MsgResult>{
    let params = "format=json&qualityFactor="+obj.qualityFactor+"&dataType="+obj.dataType+"&checkedSiteCodes="+obj.checkedSiteCodes+"&startTime="+obj.startTime+"&endTime="+obj.endTime;
    return this.requestUtil.get(DamAPI.getAirQualityCompareData,params);
  }
}
